<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/v2/console/common/taglibs.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
	<title>校咖官网</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" href="${path}/v2/site/css/homepage.css">
	<script src="${path}/v2/console/js/jquery-1.9.1.min.js"></script>
	<script src="${path}/v2/site/artjs/template.js"></script>
</head>
<body>
<div class="header">
	<jsp:include page="header.jsp"></jsp:include>
    <div class="homeMain clearfix">
        <div class="homeMain_tips clearfix">
            <div class="homeBanner_tips fl">
                <div class="homeBanner" id="piccontent"></div>
                <div class="point" id="foucuscontent"></div>
            </div>
            <div class="newsList fl">
                <p class="pbg_bor"><span>新闻动态</span></p>
                <ul class="listul">
                	<c:forEach items="${NomeTnode.arlist}" var="article" varStatus="status">
                    	<a href="${pageContext.request.contextPath}/web/${article.nodeId}/${article.articleId }.html"><li>${fn:substring(article.title, 0, 26)}</li></a>
                    </c:forEach>
                </ul>
            </div>
        </div>
        <div class="navcont clearfix">
            <p class="navcontbg"></p>
            <p class="navcont_title">专题活动</p>
            <c:forEach items="${slist}" var="sobj">
            	<div>
            		<a href="${sobj.url }">
	                <img src="${staticpath}${sobj.pic}" alt="${sobj.name }"/>
	                </a>
	                <p>${sobj.name }</p>
	            </div>
            </c:forEach>
        </div>
        
        <c:forEach items="${tlist}" var="tobj">
        <div class="traincont clearfix pb10">
            <p class="navcontbg"></p>
            <p class="navcont_title">${tobj.name}</p>
            <div class="cont">
                <div class="one fl">
                	<c:if test="${tobj.listsize >= 1 && tobj.nlist[0].asize>0}">
                		<a href="${pageContext.request.contextPath}/web/${tobj.nlist[0].alist[0].nodeId}/${tobj.nlist[0].alist[0].articleId }.html">
                    	<img src="${staticpath}${tobj.nlist[0].alist[0].picLink}" alt=""/>
                    	</a>
                    </c:if>
                </div>
                <div class="two fl">
                	<c:if test="${tobj.listsize >= 1 }">
	                    <p class="bg_bottom clearfix"> <span class="one fl">${tobj.nlist[0].name }</span>  <a href="${pageContext.request.contextPath}/web/${tobj.nlist[0].id}.html"><span class="two">more></span></a></p>
	                    <ul class="traincont_list">
	                        <c:forEach items="${tobj.nlist[0].alist}" var="article" varStatus="status">
		                    	<a href="${pageContext.request.contextPath}/web/${article.nodeId}/${article.articleId }.html"><li>${fn:substring(article.title, 0, 28)}</li></a>
		                    </c:forEach>
	                    </ul>
                    </c:if>
                </div>
                
                <div class="three fl clearfix">
                   <c:if test="${tobj.listsize >= 2 }">
	                    <p class="title pbg_bor"><span>${tobj.nlist[1].name }</span></p>
	                    <div class="right">
	                    	
	                    	<c:if test="${tobj.nlist[1].asize >= 1 }">
	                    	<div class="fl tips pr">
		                            <a href="${pageContext.request.contextPath}/web/${tobj.nlist[1].alist[0].nodeId}/${tobj.nlist[1].alist[0].articleId}.html">
		                            <img src="${staticpath}${tobj.nlist[1].alist[0].picLink}" alt=""/>
		                            </a>
		                            <p >${tobj.nlist[1].alist[0].title}</p>
		                            </div>
	                        </c:if>
	                        
	                        
	                        <c:if test="${tobj.nlist[1].asize >= 2 }">
	                        <div class="fl tips pr" style="margin-left: 6px">
		                        <a href="${pageContext.request.contextPath}/web/${tobj.nlist[1].alist[1].nodeId}/${tobj.nlist[1].alist[1].articleId}.html">
		                            <img src="${staticpath}${tobj.nlist[1].alist[1].picLink}" alt=""/>
		                        </a>
		                            <p >${tobj.nlist[1].alist[1].title}</p>
		                            </div>
	                        </c:if>
	                        
	                        <c:if test="${tobj.nlist[1].asize >= 3 }">
		                        <div class="fl last  pr">
		                        <a href="${pageContext.request.contextPath}/web/${tobj.nlist[1].alist[2].nodeId}/${tobj.nlist[1].alist[2].articleId}.html">
		                            <img src="${staticpath}${tobj.nlist[1].alist[2].picLink}" alt=""/>
		                         </a>
		                            <p>${tobj.nlist[1].alist[2].title}</p>
		                        </div>
	                        </c:if>
	               		</div>
	                </c:if>
                </div>
            </div>
        </div>
        </c:forEach>
        
        <div class="project">
            <p class="navcontbg"></p>
            <p class="navcont_title">项目合作</p>
            <div class="project_cont">
            	<c:forEach items="${plist}" var="pobj">
            		<p class="fl">
            			<a href="${sobj.url }">
	                    <img src="${staticpath}${pobj.pic}" alt="${pobj.name}"/>
	                    </a>
	                </p>
            	</c:forEach>
            </div>
        </div>
    </div>
    
        <jsp:include page="footer.jsp"></jsp:include>
</div>
		<script id="loadpic" type="text/html">
				{{each alist as value i}}
				<div class="one same" 
                {{if i>0}}
                  style="display:none"
                {{else}}{{/if}}
                  >
					<a href="${pageContext.request.contextPath}/web/{{value.nodeId }}/{{value.articleId }}.html">
						<img src="${staticpath}{{value.picLink}}"/>
						<p class="" style="color:white;margin:0;">&nbsp;&nbsp;{{value.title }}</p>
					</a>
				</div>
				{{/each}}
		</script>                                                                                                  
		<script id="picFocus" type="text/html">                                                                    
				{{each alist as value i}}                                                                          
					{{if i == 0}}                                                                                  
						<span style="background: white"></span>                                                    
					{{else}}
						<span></span>
					{{/if}}
				{{/each}}
		</script>
<script>
		$(function(){
			loadPic();
		    var i=0;
		    window.setInterval(function () {
		        if(i==$(".same").length){
		            i=0;
		        }
		        carousel(i);
		        i++;
		    },3000);
		});

		function carousel(j){
		    for(var i=0;i<$(".same").length;i++){
		        $($(".same")[i]).css("display","none");
		    }
		    for(var i=0;i<$(".point span").length;i++){
		        $($(".point span")[i]).css("background","gainsboro");
		    }
		    $($(".same")[j]).css("display","block");
		    $($(".point span")[j]).css("background","white");
		}
		///加载轮播图片
		function loadPic(){
			$.ajax({
				type : "post",
				url : "${path}/web/loadpic.html",
				dataType : "json",
				data:{},
				async : false,
				success : function(data) {
					if(data.ajax_status == "ajax_status_success"){
						var phtml = template('loadpic', data);
						$('#piccontent').append(phtml);
						var fhtml = template('picFocus', data);
						$('#foucuscontent').append(fhtml);
					}else{
						alert(data.msg);
					}
					
				},
				error : function(XMLHttpRequest, textStatus, errorThrown){
		          alert("出错了！");
		       }
			});
		}

</script>
</body>
</html>
